/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Andrés Felipe
 */
@Entity
@Table(name = "\"javeriana.sc.cc\".\"t_emailPyme\"")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmailPyme.findAll", query = "SELECT e FROM EmailPyme e"),
    @NamedQuery(name = "EmailPyme.findByIdemail", query = "SELECT e FROM EmailPyme e WHERE e.idemail = :idemail"),
    @NamedQuery(name = "EmailPyme.findByHost", query = "SELECT e FROM EmailPyme e WHERE e.host = :host"),
    @NamedQuery(name = "EmailPyme.findByPort", query = "SELECT e FROM EmailPyme e WHERE e.port = :port"),
    @NamedQuery(name = "EmailPyme.findByUsername", query = "SELECT e FROM EmailPyme e WHERE e.username = :username"),
    @NamedQuery(name = "EmailPyme.findByPassword", query = "SELECT e FROM EmailPyme e WHERE e.password = :password")})
public class EmailPyme implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idemail")
    private Integer idemail;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "host")
    private String host;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "port")
    private String port;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "username")
    private String username;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "password")
    private String password;
    @JoinColumn(name = "pymeidentification", referencedColumnName = "identification")
    @ManyToOne( optional = false)
    private Pyme pymeidentification;

    public EmailPyme() {
    }

    public EmailPyme(Integer idemail) {
        this.idemail = idemail;
    }

    public EmailPyme(Integer idemail, String host, String port, String username, String password) {
        this.idemail = idemail;
        this.host = host;
        this.port = port;
        this.username = username;
        this.password = password;
    }

    public Integer getIdemail() {
        return idemail;
    }

    public void setIdemail(Integer idemail) {
        this.idemail = idemail;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Pyme getPymeidentification() {
        return pymeidentification;
    }

    public void setPymeidentification(Pyme pymeidentification) {
        this.pymeidentification = pymeidentification;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idemail != null ? idemail.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmailPyme)) {
            return false;
        }
        EmailPyme other = (EmailPyme) object;
        if ((this.idemail == null && other.idemail != null) || (this.idemail != null && !this.idemail.equals(other.idemail))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.EmailPyme[ idemail=" + idemail + " ]";
    }
    
}
